package com.itheima.condtion.config;

import com.itheima.condtion.ClassCondition;
import com.itheima.condtion.pojo.Apple;
import com.itheima.condtion.pojo.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class UserConfiguration {

    //@Bean
    //public Apple apple() {
    //    return new Apple();
    //}

    //@Conditional(ClassCondition.class)
    @Bean
    //@ConditionalOnMissingBean(Apple.class)
    @ConditionalOnProperty(name = "itheima", havingValue = "i love")
    public User user() {

        return new User();
    }
}
